import { createApp } from 'vue'
import Antd from 'ant-design-vue';
import router from './router';
import './style.css'
import App from './App.vue'
import 'ant-design-vue/dist/reset.css';
router.beforeEach((to, from, next) => {
    const token = localStorage.getItem('token');
    if (!token && to.name != 'login') {
        next({ path: '/login' })
    } else if (token && to.name === 'login') {
        next({ path: '/carousel' })
    } else {
        next()
    }
});
const app = createApp(App);
app.config.globalProperties.$URL = import.meta.env.VITE_BASE_URL;
app.use(Antd).use(router).mount('#app')
